<template>

	<view>
		<bg-video></bg-video>
		<cu-custom bgColor="bg-purple" :isBack="true">
			<block slot="content">门店详细</block>
		</cu-custom>
		<view class="padding-sm">
			<view class="shadow rounded">
				<view class="padding-sm flex justify-start align-center bg-blue text-white">
					<text class="iconfont icon-huiyuangoumai">所属门店</text>
				</view>
				<view class="bg-white">
					<view class="padding-sm flex justify-between align-center">
						<text>名称：</text>
						<text>{{ssmd.sname}}</text>
					</view>
					<view class="padding-sm flex justify-between align-center">
						<text>地址：</text>
						<text>{{ssmd.address}}</text>
					</view>
					<view v-if="ssmd.cover" class="padding-sm flex justify-between align-center">
						<image class="w-100" mode="aspectFill" :src="ssmd.cover"></image>
					</view>
				</view>
			</view>
		</view>
		<view class="padding-sm">
			<view class="shadow rounded">
				<view class="padding-sm flex justify-start align-center bg-pink text-white">
					<text class="iconfont icon-huiyuangoumai">已开课程</text>
				</view>
				<view class="bg-white">
					<view class="padding-xs">
						<view class="bg-white shadow radius margin-bottom-xs" v-for="(kc,index) in kcs" :key="index">
							<kc-item :path="'/pages/cmdjl'" :kc="kc"></kc-item>
						</view>
					</view>
					
					<view v-if="kcs.length < pageInfo.total" class="padding ">
						<button @tap="loadMore" class="cu-btn block bg-purple lg">显示更多</button>
					</view>
					<view class="padding-sm text-center" v-if="kcs.length == 0">暂无内容</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data: function() {
			return {
				mdjl: this.store.state.mdjl.mdjlid,
				ssmd: undefined,
				kcs: [],
				pageInfo: {
					current: 1,
					size: 16,
					total: 0
				}
			}
		},
		methods: {
			loadSsmd: function() {
				this.ssmd = this.constant.mdmap[this.mdjl.storeid];
			},
			loadKc: function() {
				
			},
			search: function() {
				this.kcs = [];
				this.pageInfo.current = 1;
				this.loadKcs();
			},
			loadMore: function() {
				this.pageInfo.current++;
				this.loadKcs();
			},
			loadKcs: function() {
				let param = {
					current: this.pageInfo.current,
					size: this.pageInfo.size,
					mdid: this.ssmd.storeid,
				};
				this.api("/kc/page").send(param).then(data => {
					this.pageInfo.current = data.akechengs.current;
					for (let index in data.akechengs.records) {
						let record = data.akechengs.records[index];
						this.kcs.push(record);
					}
				});
			}
		}
	}
</script>

<style scoped>



</style>